/*
 * 文件名：CommentaryDaoImpl.java
 * 版权：Copyright 2007-2015 517na Tech. Co. Ltd. All Rights Reserved. 
 * 描述： CommentaryDaoImpl.java
 * 修改人：yanshu
 * 修改时间：2015年12月24日
 * 修改内容：新增
 */
package com.feichuang.chineseWoodCarving.dao.impl;

import java.util.Date;
import java.util.List;

import org.springframework.stereotype.Component;

import com.feichuang.chineseWoodCarving.dao.ICommentaryDao;
import com.feichuang.chineseWoodCarving.interceptor.BeanUtils;
import com.feichuang.chineseWoodCarving.model.MCommentary;

/**
 * TODO 添加类的一句话简单描述.
 * <p>
 * TODO 详细描述
 * <p>
 * TODO 示例代码
 * 
 * <pre>
 * </pre>
 * 
 * @author yanshu
 */
@Component("commentaryDao")
public class CommentaryDaoImpl extends BaseDaoImpl implements ICommentaryDao {

    /**
     * {@inheritDoc}.
     */
    @Override
    public boolean insertCommentary(MCommentary commentary) {
        commentary.setAddTime(new Date());
        BeanUtils.notNull(commentary);
        this.sqlSession.insert("com.feichuang.chineseWoodCarving.dao.ICommentaryDao.insertCommentary", commentary);
        return true;
    }

    /**
     * {@inheritDoc}.
     */
    @Override
    public boolean deleteMCommentary(MCommentary commentary) {
        this.sqlSession.update("com.feichuang.chineseWoodCarving.dao.ICommentaryDao.deleteMCommentary", commentary);
        return false;
    }

    /**
     * {@inheritDoc}.
     */
    @Override
    public List<MCommentary> selectMCommentary(MCommentary commentary) {
        List<MCommentary> list = this.sqlSession.selectList("com.feichuang.chineseWoodCarving.dao.ICommentaryDao.selectMCommentary", commentary);
        return list;
    }
}
